package com.wxy.demo.main;

import java.util.concurrent.TimeUnit;

/**
 * <p>
 * 测试主线程阻塞
 * </p>
 *
 * @author e-Xiaoyuan.Wang
 * @since 2022/8/22 16:42
 */
public class MainDemo {
    public static void main(String[] args) {
        System.out.println("执行主线程代码");
        new Thread(() -> {
            System.out.println("执行子线程代码，并阻塞10秒");
            try {
                TimeUnit.SECONDS.sleep(10);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }).start();
    }
}
